<?php
	get_header();
        $row_display = get_option('number_row_all_deal');
            $display = $row_display*4;
            if($row_display == ''){
                $display = 16;
            }
?>

<div id="all-deals">
    <h1 id="inner-title"> Past deals</h1>
    <p class="past-deal-note">Here you can see some of the past deals that we have run on FindsDeals.</p>
    <hr/>
    <div class="categories-menu">
        <?php 
            $link_all_deals = site_url('/past-deals');
        ?>
        <span class=""><a class="list-by-category" href="<?php echo $link_all_deals;?>">All</a></span>
        <?php
            cpx_print_categories(1, 1);
        ?>
    </div>
    <hr/>
            <?php
            $cat_id = '';
            if($_GET['cat']){ ?>
            <div class="all-deals-list row-fluid">
            <?php
                $cat_id = $_GET['cat'];
                $deactive_deals_ids_by_cat = cpx_get_past_deals($cat_id);
                if(count($deactive_deals_ids_by_cat) > 0)
                {
                    $row_display = get_option('number_row_past_deal');
                    $display = $row_display*4;
                    if($row_display == ''){
                       $display = 16;
                    }
                    pagination_jquery($deactive_deals_ids_by_cat,0,0,0,$display);
                } ?>
            </div>    
            <?php }
            else
            {
                cpx_get_deals('', $display, 1, 'deactive', 0, false, true);
            }
                
            ?>
</div>
<?php
	get_footer();
?>